﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unity.Mathematics;
using UnityEngine;

namespace Miao
{
    /// <summary>
    /// 原始的单贴图预寸渲染试验
    /// </summary>
    public class Graphic
    {
        public Texture2D mainTex;

        //直接使用外部图片图层，防止压缩
        //public Vector2 drawSize = Vector2.one;
        public Material MatSingle;
        //rm是x,z视角


        public void DrawWorker(Vector3 loc, Quaternion rotation)
        {
            

            var size = new Vector2(MatSingle.mainTexture.width *0.01f, MatSingle.mainTexture.height * 0.01f);

            Mesh mesh = MeshPool.GridPlane(size);
            DrawMeshInt(mesh, loc, rotation, MatSingle);
            //return MeshPool.GridPlane(drawSize);
        }

        protected virtual void DrawMeshInt(Mesh mesh, Vector3 loc, Quaternion quat, Material mat)
        {
            Graphics.DrawMesh(mesh, loc, quat, mat, 0);
        }

        public virtual void Init(GraphicData graphicData)
        {
            

        }

    }
}
